package com.smartrodin.springbootrabbitmq.util;

import java.util.concurrent.DelayQueue;
import java.util.concurrent.TimeUnit;

/**
 * @author: arnold_nie
 * @date: 2020/12/25 19:45
 * FileName: Test
 * Description:  测试类
 */
public class Test {

    /** 延迟队列 */
    private static final DelayQueue<Task> QUEUE_TASK = new DelayQueue<>();

    public static void main(String[] args) throws InterruptedException {
        System.out.println("------------------------------------------------------");
        // 5 秒钟后执行
        QUEUE_TASK.add(new Task("Hello ... ", TimeUnit.SECONDS,5));
        System.out.println(QUEUE_TASK.take().getData());
    }
}
